/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import cn.webrx.mapper.StudentMapper;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * <p>Project: mybatis2021 - MyApp
 * <p>Powered by webrx On 2021-07-20 11:01:33
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 15
 */
public class MyApp {
    public static void main(String[] args) {
        //spring IoC
        var ctx = new ClassPathXmlApplicationContext("beans.xml");
        //for (String n : ctx.getBeanDefinitionNames()) {
        //    System.out.println(n);
        //}
        //mybatis dao
        StudentMapper sm = ctx.getBean("studentMapper",StudentMapper.class);
        System.out.println(sm.query());
        SqlSession ss = ctx.getBean("ss",SqlSession.class);
        SqlSessionFactory sf = ctx.getBean("sf",SqlSessionFactory.class);
        System.out.println(ss);
        System.out.println(sf);
    }
}
